<template>
	<view class="page-my">
		<view @tap="intoMyInfo">
			<cl-list justify="start" :border="false">
				<view class="info" >
					<cl-avatar
						:size="120"
						:src="img"
					></cl-avatar>
			
					<view class="content">
						<text class="name">{{username}}</text>
						<text class="id">ID：{{id}}</text>
					</view>
				</view>
			
				<text slot="suffix" class="cl-icon-arrow-right"></text>
			</cl-list>
		</view>
		

		<view class="vip">
			<view class="content">
				<text class="level">至尊版</text>
				<text class="tips">过期时间:2099-1-1</text>
			</view>
			<button class="renew-btn" size="mini">永久</button>
		</view>

		<!-- <cl-list label="钱包">
			<image slot="icon" src="@/static/icon/wallet.png" alt />
			<text slot="suffix" class="cl-icon-arrow-right"></text>
		</cl-list>

		<cl-list label="收藏">
			<image slot="icon" src="@/static/icon/collection.png" alt />
			<text slot="suffix" class="cl-icon-arrow-right"></text>
		</cl-list>
 -->
 
		<view @click="intoPrivacy">
			<cl-list label="隐私" >
				<image slot="icon" src="@/static/icon/privacy.png" alt />
				<text slot="suffix" class="cl-icon-arrow-right"></text>
			</cl-list>
		</view>

		<view @click="intoSetting">
			<cl-list label="设置">
				<image slot="icon" src="@/static/icon/set.png" alt />
				<text slot="suffix" class="cl-icon-arrow-right"></text>
			</cl-list>
		</view>
		

		<cl-list label="联系客服">
			<image slot="icon" src="@/static/icon/customer-service.png" alt />
			<text>9:30-18:00</text>
			<text slot="suffix" class="cl-icon-arrow-right"></text>
		</cl-list>
	</view>
</template>

<script>
import http from '@/common/requestConfig.js';
export default {
	components: {
		http
	},
	data(){
		return{
			img:"",
			username:"获取中...",
			id:0
		};
	},
	onLoad() {
		var that = this;
		http.post("customer/GetInfo", {}
		).then(res => {
			if(res.code == 1){
				res = res.data;
				that.img = global.baseUrl + res.img;
				that.username = res.username;
				that.id = res.id;
			}
		}).catch(res=>{
			//console.log('throw error..');
			//that.LoginInfo();
		});
	},
	methods:{
		intoMyInfo(){
			uni.navigateTo({
				url: "./myinfo"
			})
		},
		intoSetting(){
			uni.navigateTo({
				url: "./setting"
			})
		},
		intoPrivacy(){
			uni.navigateTo({
				url:"./privacy"
			})
		}
	}
	
};
</script>

<style lang="scss" scoped>
.page-my {
	.info {
		display: flex;
		align-items: center;
		margin: 30rpx 0;

		.content {
			display: flex;
			flex-direction: column;
			margin-left: 30rpx;

			.name {
				font-size: 34rpx;
				margin-bottom: 10rpx;
			}

			.id {
				font-size: 24rpx;
			}
		}
	}

	.vip {
		display: flex;
		align-items: center;
		background-color: #000;
		margin: 20rpx 20rpx 50rpx 20rpx;
		padding: 40rpx 30rpx;
		border-radius: 16rpx;

		.content {
			display: flex;
			flex-direction: column;
			flex: 1;
			color: #fff;

			.level {
				font-size: 30rpx;
				margin-bottom: 10rpx;
			}

			.tips {
				color: #ccc;
				font-size: 24rpx;
			}
		}

		.renew-btn {
			display: inline-block;
			background-color: #ffc100;
			color: #222222;
			border-radius: 60rpx;
			font-size: 26rpx;

			&::after {
				border: 0;
			}
		}
	}

	.cl-list {
		margin: 0 20rpx;
	}
}
</style>